package model;

import com.google.code.morphia.Morphia;
import java.net.UnknownHostException;
import com.mongodb.Mongo;
import com.mongodb.MongoException;

public class DBConnection {

	private static Mongo m = null;
	private static final String host = "o2tv.vn";
	private static final String database = "news";
	private static Morphia morphia = null;

	public static Mongo getMongo() {
		if (m == null) {
			try {
				m = new Mongo(host);
			} catch (UnknownHostException e) {
				// TODO Auto-generated catch block
			} catch (MongoException e) {
				// TODO Auto-generated catch block
			}
		}
		return m;
	}

	public static String getDatabase() {
		return database;
	}

	public static Morphia getMorphia() {
		if (morphia == null) {
			morphia = new Morphia();
		}
		return morphia;
	}
}
